// ignore_for_file: non_constant_identifier_names
import 'package:flutter/material.dart';
import 'package:wallpaper/components/placeholder/appbar_base.dart';
import 'package:wallpaper/components/my_types.dart';
import 'package:wallpaper/generated/l10n.dart';
import 'package:wallpaper/pages/other/360/image_list_360.dart';

class Class360 extends StatefulWidget {
  const Class360({super.key});

  @override
  State<Class360> createState() => _Class360State();
}

class _Class360State extends State<Class360>
    with AutomaticKeepAliveClientMixin {
  List types = [
    ['4K专区', 36],
    ['美女模特', 6],
    ['爱情美图', 30],
    ['风景大片', 9],
    ['小清新', 15],
    ['动漫卡通', 26],
    ['明星风尚', 11],
    ['萌宠动物', 14],
    ['游戏壁纸', 5],
    ['汽车天下', 12],
    ['炫酷时尚', 10],
    ['月历壁纸', 29],
    ['影视剧照', 7],
    ['节日美图', 13],
    ['军事天地', 22],
    ['劲爆体育', 16],
    ['BABY秀', 18],
    ['文字控', 35]
  ];

  List<TypesBase> categoryList = [];
  String typeBase =
      'https://gitee.com/zsnoin-can/new-wall-paper-apk/raw/master/360';

  Future<void> getCategory() async {
    for (int i = 0; i < types.length; i++) {
      setState(() {
        categoryList.add(TypesBase(
          name: types[i][0],
          page: ImageList360(
            cids: types[i][1].toString(),
            title: types[i][0],
          ),
          bg: '$typeBase/c${i + 1}.jpg',
        ));
      });
    }
  }

  @override
  void initState() {
    super.initState();
    getCategory();
  }

  @override
  Widget build(BuildContext context) {
    super.build(context);
    return Scaffold(
      appBar: AppbarBase(title: S.of(context).a17),
      body: MyTypes(
        wallpapges: categoryList,
        vertical: false,
        isScroll: true,
      ),
    );
  }

  @override
  bool get wantKeepAlive => true;
}
